var express = require('express');
var router = express.Router();
let { getClaims, addClaims, updateClaims, deleteClaimsById, getClaimsById, againReapply, agreeReapply, disagreeReapply} = require('../service/claimsService')

//获取理赔列表
router.get('/getClaims', async function (req, res, next) {
    let data = await getClaims(req.query)
    res.send(data)
});
//新增理赔
router.post('/addClaims', async function (req, res) {
    let data = await addClaims(req.body)
    res.send(data)
});
//获取某个理赔数据
router.post('/getClaimsById', async (req, res) => {
    res.send(await getClaimsById(req.body))
})
//修改
router.post('/updateClaims', async function (req, res, next) {
    let data = await updateClaims(req.body)
    res.send(data)
});
//删除理赔
router.post('/deleteClaimsById', async function (req, res, next) {
    let data = await deleteClaimsById(req.body)
    res.send(data)
});
//修改理赔状态
router.post('/againReapply', async function (req, res, next) {
    let data = await againReapply(req.body)
    res.send(data)
});
//同意理赔状态
router.post('/agreeReapply', async function (req, res, next) {
    let data = await agreeReapply(req.body)
    res.send(data)
});
//拒绝理赔状态
router.post('/disagreeReapply', async function (req, res, next) {
    let data = await disagreeReapply(req.body)
    res.send(data)
});
module.exports = router;